package com.heima.wemedia.controller.v1;

import com.heima.common.dtos.PageResponseResult;
import com.heima.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Arrays;

@RestController
@RequestMapping("/api/v1/material")
public class WmMaterialController {
    @Autowired
    private WmMaterialService wmMaterialService;

    /*
        上传素材
     */
    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture(MultipartFile multipartFile){
        System.out.println("执行");
        // 上传图片
        return wmMaterialService.uploadPicture(multipartFile);
    }

    /*
        素材列表
     */
    @PostMapping("/list")
    public PageResponseResult findList(@RequestBody WmMaterialDto dto){
        System.out.println("进入listController");
        return wmMaterialService.findList(dto);
    }


}
